{% extends "base.html" %}

{% block title %}编辑服务器{% endblock %}


{% block navbar %}
<section class="content-header">
    <h1>编辑服务器</h1>
    <ol class="breadcrumb">
        <li><i class="fa fa-dashboard"></i> 当前位置</li>
        <li class="active">服务器管理</li>
        <li class="active">服务器配置</li>
    </ol>
</section>
{% endblock %}


{% block content %}
<div class="box box-primary">
    <form method="post" enctype="multipart/form-data">
        {{form.hidden_tag()}}
        <div class="box-header with-border">
            {% include 'message.html' %}
        </div>

        <div class="box-body">
            <div class="col-md-6">
                <div class="form-group">
                    <label>{{form.name.label}}</label>
                    {{form.name(class_="form-control",placeholder="请输入名称")}}
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label>{{form.ip.label}}</label>
                    {{form.ip(class_="form-control select2",placeholder="请输入IP地址或域名")}}
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label>{{form.port.label}}</label>
                    {{form.port(class_="form-control",placeholder="请输入端口, 默认22")}}
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label>{{form.user.label}}</label>
                    {{form.user(class_="form-control",placeholder="请输入用户名")}}
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label>{{form.passwd.label}}</label>
                    {{form.passwd(class_="form-control",placeholder="请输入密码")}}
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label>{{form.perm.label}}</label>
                    {{form.perm(class_="form-control",placeholder="请上传密钥文件")}}
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label>{{form.passcode.label}}</label>
                    {{form.passcode(class_="form-control",placeholder="请输入密钥密码")}}
                </div>
            </div>
        </div>

        <div class="box-footer">
            <div class="col-md-12">
                {{form.submit(class_="btn btn-primary pull-right")}}
            </div>
        </div>
    </form>
</div>
{% endblock %}

{% block scripts %}
<script>
    function initPage() {
        slide_value = $(".slider").val() == "" ? 50 : parseInt($(".slider").val());
        $(".slider").slider({
            id: "blue",
            max: 100,
            value: slide_value
        });

        switch_value = $('#status')[0].checked
        $('#status').bootstrapSwitch({
            state: switch_value,
            onText: '生效',
            offText: '失效'

        });

        $(".select2").select2();
    }
</script>
{% endblock %}